/******************************************************************************
* File description: SettingDataStatistic.qml
* Function: 设置-数据统计
* Current Version: 1.0.0
* Author: 张宇轩
* Date: 2024-08-30
*  -----
*  Copyright by 博坤生物 .
 *****************************************************************************/
import QtQuick 2.14
import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14
import QtGraphicalEffects 1.14

Item {
    id: root

    /* property 定义开始 */
    // 信号
    signal settingReturnSig()
    /* property 定义结束 */

    // 顶部导航栏
    TabbarNav {
        id: tabNav
        width: parent.width
        height: 56
        isEnable: true
        title: "数据统计"

        onReturnSig: {
            root.settingReturnSig()
            console.log("tabbar nav")
        }
        z: 999
    }

    ColumnLayout {
        anchors.fill: parent
        spacing: 0

        // 主体部分
        Rectangle {
            id: mainPart
            Layout.fillWidth: true
            Layout.preferredHeight: parent.height - btnContainer.height
            Layout.alignment: Qt.AlignTop

            // 背景
            Rectangle {
                anchors.fill: parent
                LinearGradient {
                    anchors.fill: parent
                    start: Qt.point(0, 0)
                    end: Qt.point(0, height)
                    gradient: Gradient {
                        GradientStop {position: 0.0; color: "#007BD8"}
                        GradientStop {position: 1.0; color: "#001A5A"}
                    }
                }
            }

            // 内容
            RowLayout {
                id: mainContentLayout
                anchors {
                    top: parent.top
                    left: parent.left
                    right: parent.right
                    topMargin: 150
                    leftMargin: 16
                    rightMargin: 16
                }

                // 设备运行时长
                Item {
                    Layout.preferredWidth: 242
                    Layout.preferredHeight: 150

                    Image {
                        anchors.fill: parent
                        source: "qrc:/icons/setting_datastas_running.png"
                    }

                    ColumnLayout {
                        anchors.fill: parent
                        spacing: 16

                        CustomVerSpacerItem {}

                        Label {
                            Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
                            font.pixelSize: 16
                            color: "#FF222222"
                            text: "设备运行时长 h"
                        }

                        Label {
                            Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
                            font.pixelSize: 30
                            color: "#FF222222"
                            text: "1000.52"
                        }

                        CustomVerSpacerItem {}
                    }
                }

                // 检测时长
                Item {
                    Layout.preferredWidth: 242
                    Layout.preferredHeight: 150

                    Image {
                        anchors.fill: parent
                        source: "qrc:/icons/setting_datastas_jiance.png"
                    }

                    ColumnLayout {
                        anchors.fill: parent
                        spacing: 16

                        CustomVerSpacerItem {}

                        Label {
                            Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
                            font.pixelSize: 16
                            color: "#FF222222"
                            text: "检测时长"
                        }

                        Label {
                            Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
                            font.pixelSize: 30
                            color: "#FF222222"
                            text: "1000.52"
                        }

                        CustomVerSpacerItem {}
                    }
                }

                // 试验次数
                Item {
                    Layout.preferredWidth: 242
                    Layout.preferredHeight: 150

                    Image {
                        anchors.fill: parent
                        source: "qrc:/icons/setting_datastas_expcishu.png"
                    }

                    ColumnLayout {
                        anchors.fill: parent
                        spacing: 16

                        CustomVerSpacerItem {}

                        Label {
                            Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
                            font.pixelSize: 16
                            color: "#FF222222"
                            text: "试验次数"
                        }

                        Label {
                            Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
                            font.pixelSize: 30
                            color: "#FF222222"
                            text: "8000"
                        }

                        CustomVerSpacerItem {}
                    }
                }

                // 总检测样本数
                Item {
                    Layout.preferredWidth: 242
                    Layout.preferredHeight: 150

                    Image {
                        anchors.fill: parent
                        source: "qrc:/icons/setting_datastas_totalsample.png"
                    }

                    ColumnLayout {
                        anchors.fill: parent
                        spacing: 16

                        CustomVerSpacerItem {}

                        Label {
                            Layout.alignment: Qt.AlignHCenter | Qt.AlignBottom
                            font.pixelSize: 16
                            color: "#FF222222"
                            text: "总检测样本数"
                        }

                        Label {
                            Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
                            font.pixelSize: 30
                            color: "#FF222222"
                            text: "1005"
                        }

                        CustomVerSpacerItem {}
                    }
                }
            }

            // 注意
            Label {
                anchors {
                    top: mainContentLayout.bottom
                    topMargin: 15
                    left: parent.left
                    leftMargin: 16
                }
                font.pixelSize: 14
                color: "red"
                text: "*注：请检查红色预警信息并根据指导方案对设备进行维护保养"
            }
        }

        // 按钮部分
        Rectangle {
            id: btnContainer
            Layout.fillWidth: true
            Layout.preferredHeight: 80

            RowLayout {
                height: parent.height
                anchors.rightMargin: 16
                anchors.right: parent.right

                PureButton {
                    id: canceledBtn
                    pureText: "取消(C)"
                    Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
                }
            }
        }
    }
}
